package com.atguigu.petstore.coupon.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 优惠 - 优惠券消费记录
 * @TableName coupon_used_logs
 */
@TableName(value ="coupon_used_logs")
@Data
public class CouponUsedLogs implements Serializable {
    /**
     * 自动增加ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 买家ID
     */
    @TableField(value = "buyer_id")
    private Long buyerId;

    /**
     * 优惠券id
     */
    @TableField(value = "coupon_receive_id")
    private Long couponReceiveId;

    /**
     * 订单id
     */
    @TableField(value = "order_id")
    private Long orderId;

    /**
     * 原订单金额
     */
    @TableField(value = "order_original_amount")
    private BigDecimal orderOriginalAmount;

    /**
     * 优惠券的金额
     */
    @TableField(value = "coupon_amount")
    private BigDecimal couponAmount;

    /**
     * 抵扣优惠券之后的订单金额
     */
    @TableField(value = "order_final_amount")
    private BigDecimal orderFinalAmount;

    /**
     * 领取时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 日志状态: 默认为0，支付回调成功后为1
     */
    @TableField(value = "status")
    private Integer status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CouponUsedLogs other = (CouponUsedLogs) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getBuyerId() == null ? other.getBuyerId() == null : this.getBuyerId().equals(other.getBuyerId()))
            && (this.getCouponReceiveId() == null ? other.getCouponReceiveId() == null : this.getCouponReceiveId().equals(other.getCouponReceiveId()))
            && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getOrderOriginalAmount() == null ? other.getOrderOriginalAmount() == null : this.getOrderOriginalAmount().equals(other.getOrderOriginalAmount()))
            && (this.getCouponAmount() == null ? other.getCouponAmount() == null : this.getCouponAmount().equals(other.getCouponAmount()))
            && (this.getOrderFinalAmount() == null ? other.getOrderFinalAmount() == null : this.getOrderFinalAmount().equals(other.getOrderFinalAmount()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getBuyerId() == null) ? 0 : getBuyerId().hashCode());
        result = prime * result + ((getCouponReceiveId() == null) ? 0 : getCouponReceiveId().hashCode());
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getOrderOriginalAmount() == null) ? 0 : getOrderOriginalAmount().hashCode());
        result = prime * result + ((getCouponAmount() == null) ? 0 : getCouponAmount().hashCode());
        result = prime * result + ((getOrderFinalAmount() == null) ? 0 : getOrderFinalAmount().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", buyerId=").append(buyerId);
        sb.append(", couponReceiveId=").append(couponReceiveId);
        sb.append(", orderId=").append(orderId);
        sb.append(", orderOriginalAmount=").append(orderOriginalAmount);
        sb.append(", couponAmount=").append(couponAmount);
        sb.append(", orderFinalAmount=").append(orderFinalAmount);
        sb.append(", createTime=").append(createTime);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}